﻿<%@ Page Title="" Language="C#" MasterPageFile="~/DepartmentMaster.Master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="Department.Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content" ContentPlaceHolderID="mainContentHolder" runat="server">
    <h4>
        <asp:Label ID="MustLoginLabel" Visible="false" runat="server" Text="За да видите съдържанието на тази страница, трябва да влезете като потребител от ">
            <asp:HyperLink ID="LoginLink" runat="server" Text="тук" NavigateUrl="~/Login.aspx">
            </asp:HyperLink></asp:Label></h4>
    <div id="filter">
        <asp:UpdatePanel ID="FilterUpdatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:Panel ID="FilterHeader" runat="server" Visible="false">
                    <asp:LinkButton ID="FilterLnkBtn" runat="server" Text="Търсене"></asp:LinkButton><asp:Image
                        ID="Image1" runat="server" /><br />
                    <br />
                </asp:Panel>
                <asp:Panel ID="FilterBody" runat="server" DefaultButton="FilterButton">
                    <table>
                        <tr>
                            <td>
                                <asp:Label ID="FilterNameLabel" runat="server" Text="Заглавие:"></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="FilterDateLabel" runat="server" Text="Дата:"></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="FilterTextLabel" runat="server" Text="Част от описанието:"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:TextBox runat="server" ToolTip="Търсене по заглавие." ID="FilterTitleTextBox"></asp:TextBox>
                                <asp:RegularExpressionValidator runat="server" ValidationExpression="[a-zA-Zа-яА-Я0-9._\s\S]{3,50}"
                                    ControlToValidate="FilterTitleTextBox"></asp:RegularExpressionValidator>
                            </td>
                            <td>
                                <asp:TextBox runat="server" ToolTip="Търсене по дата." ID="FilterDateTextBox"></asp:TextBox>
                                <asp:CalendarExtender ID="CalendarExtender" Format="dd.MM.yyyy" TargetControlID="FilterDateTextBox"
                                    runat="server">
                                </asp:CalendarExtender>
                                <asp:RegularExpressionValidator runat="server" ValidationExpression="(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d"
                                    ControlToValidate="FilterDateTextBox"></asp:RegularExpressionValidator>
                            </td>
                            <td>
                                <asp:TextBox runat="server" ToolTip="Търсене по Част от описанието." ID="FilterDescTextBox"></asp:TextBox>
                                <asp:RegularExpressionValidator runat="server" ValidationExpression="[a-zA-Zа-яА-Я0-9._\s\S]{3,255}"
                                    ControlToValidate="FilterDescTextBox"></asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <asp:Label ID="FilterLabel" runat="server" Visible="false"></asp:Label>
                            </td>
                            <td align="right">
                                <asp:Button ID="FilterButton" runat="server" Text="Търси" OnClick="FilterButton_Click" />
                            </td>
                        </tr>
                    </table>
                    <hr />
                </asp:Panel>
                <asp:CollapsiblePanelExtender ID="cpe" CollapseControlID="FilterHeader" ExpandControlID="FilterHeader"
                    TargetControlID="FilterBody" Collapsed="true" TextLabelID="FilterLnkBtn" CollapsedSize="0"
                    CollapsedImage="~/CSS/Images/expand.gif" ExpandedImage="~/CSS/Images/collapse.gif"
                    runat="server" AutoCollapse="False" AutoExpand="False" ImageControlID="Image1">
                </asp:CollapsiblePanelExtender>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>
<asp:Content ID="DynContent" ContentPlaceHolderID="DynamicContent" runat="server">
    <%--Lecturers ListView--%>
    <asp:ListView ID="ListLecturers" runat="server" Visible="False" GroupItemCount="2">
        <layouttemplate>
            <table>
                <tr>
                    <td>
                        <table border="0" cellpadding="5">
                            <asp:PlaceHolder runat="server" ID="groupPlaceHolder"></asp:PlaceHolder>
                        </table>
                    </td>
                </tr>
            </table>
        </layouttemplate>
        <grouptemplate>
            <tr>
                <asp:PlaceHolder runat="server" ID="itemPlaceHolder"></asp:PlaceHolder>
            </tr>
        </grouptemplate>
        <itemtemplate>
            <td>
                <asp:HyperLink ID="PictureLecturerLink" ToolTip='<%# DataBinder.Eval(Container.DataItem, "Name")%>'
                    runat="server" NavigateUrl='<%#"Details.aspx?id=" + DataBinder.Eval(Container.DataItem,"ID")+ "&type=" + DataBinder.Eval(Container.DataItem,"TypeID")%>'>
                    <asp:Image runat="server" ID="PictureLecturer" Height="80px" ImageUrl='<%# Eval("PictureLink") %>' />
                </asp:HyperLink>
                <td>
                    <asp:HyperLink ID="HyperLinkLecturer" runat="server" Text='<%#Eval("Name")%>' NavigateUrl='<%#"Details.aspx?id=" + DataBinder.Eval(Container.DataItem,"ID")+ "&type=" + DataBinder.Eval(Container.DataItem,"TypeID")%>'>
                    </asp:HyperLink>
                    <br />
                    <asp:Label ID="LecturerTitle" CssClass="date" runat="server" Text='<%# Eval("DegreeName")+" "+Eval("RankName")%>' />
                </td>
        </itemtemplate>
    </asp:ListView>
    <%--<asp:DataPager ID="pagerListLecturers" runat="server" PageSize="10" PagedControlID="ListLecturers">
        <fields>
            <asp:NumericPagerField ButtonType="Link" NextPageText="Следваща" PreviousPageText="Предишна" ButtonCount="99999" />
        </fields>
    </asp:DataPager>--%>
    <%--News ListView--%>
    <asp:UpdatePanel ID="NewsUpdatePanel" runat="server" UpdateMode="Conditional">
        <contenttemplate>
            <asp:ListView ID="ListNews" runat="server" Visible="False">
                <LayoutTemplate>
                    <div id="itemPlaceholderContainer" runat="server">
                        <span id="itemPlaceholder" runat="server" />
                    </div>
                </LayoutTemplate>
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLinkNews" runat="server" Text='<%#Eval("Heading")%>' NavigateUrl='<%#"Details.aspx?id=" + DataBinder.Eval(Container.DataItem,"ID")+ "&type=" + DataBinder.Eval(Container.DataItem,"TypeID")%>'>
                    </asp:HyperLink>
                    <br />
                    <asp:Label ID="NewsDate" CssClass="date" runat="server" Text='<%#Eval("Date", "{0:D}")%>' />
                    <br />
                    <asp:Label ID="NewsText" runat="server" Text='<%#Eval("Text")%>' /><br />
                </ItemTemplate>
                <ItemSeparatorTemplate>
                    <hr />
                </ItemSeparatorTemplate>
            </asp:ListView>
        </contenttemplate>
    </asp:UpdatePanel>
    <%--<asp:DataPager ID="pagerListNews" runat="server" PageSize="20" PagedControlID="ListNews">
        <fields>
            <asp:NumericPagerField ButtonType="Link" NextPageText="Следваща" PreviousPageText="Предишна" />
        </fields>
    </asp:DataPager>--%>
    <%--Disciplines ListView--%>
    <asp:ListView ID="ListDisc" runat="server" Visible="False">
        <layouttemplate>
            <div id="itemPlaceholderContainer" runat="server">
                <span id="itemPlaceholder" runat="server" />
            </div>
        </layouttemplate>
        <itemtemplate>
            <asp:HyperLink ID="HyperLinkDisc" runat="server" Text='<%#Eval("Name")%>' NavigateUrl='<%#"Details.aspx?id=" + DataBinder.Eval(Container.DataItem,"ID") + "&type=" + DataBinder.Eval(Container.DataItem,"TypeID")%>'>
            </asp:HyperLink><br />
        </itemtemplate>
    </asp:ListView>
   <%-- <asp:DataPager ID="pagerListDisc" runat="server" PageSize="20" PagedControlID="ListDisc">
        <fields>
            <asp:NumericPagerField ButtonType="Link" NextPageText="Следваща" PreviousPageText="Предишна" />
        </fields>
    </asp:DataPager>--%>
    <%--Events ListView--%>
    <asp:UpdatePanel ID="EventsUpdatePanel" runat="server" UpdateMode="Conditional">
        <contenttemplate>
            <asp:ListView ID="ListEvents" runat="server" Visible="False">
                <LayoutTemplate>
                    <div id="itemPlaceholderContainer" runat="server">
                        <span id="itemPlaceholder" runat="server" />
                    </div>
                </LayoutTemplate>
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLinkEvents" runat="server" Text='<%#Eval("Name")%>' NavigateUrl='<%#"Details.aspx?id=" + DataBinder.Eval(Container.DataItem,"ID") + "&type=" + DataBinder.Eval(Container.DataItem,"TypeID")%>'>
                    </asp:HyperLink><br />
                    <asp:Label ID="EventDate" CssClass="date" runat="server" Text='<%#Eval("EventDate", "{0:D}")%>' />
                    <br />
                    <asp:Label ID="EventDescription" runat="server" Text='<%#Eval("Description")%>' />
                    <br />
                </ItemTemplate>
                <ItemSeparatorTemplate>
                    <hr />
                </ItemSeparatorTemplate>
            </asp:ListView>
        </contenttemplate>
    </asp:UpdatePanel>
    <%--<asp:DataPager ID="pagerListEvents" runat="server" PageSize="20" PagedControlID="ListEvents">
        <fields>
            <asp:NumericPagerField ButtonType="Link" NextPageText="Следваща" PreviousPageText="Предишна" />
        </fields>
    </asp:DataPager>--%>
    <%--Documents ListView--%>
    <h3>
        <asp:Label ID="LabelDocsDropDown" Text="Документи за: " Visible="False" runat="server">
        </asp:Label>
        <asp:DropDownList ID="DocTypeDropDown" runat="server" Visible="False" AutoPostBack="true"
            OnSelectedIndexChanged="DocTypeDropDown_SelectedIndexChanged">
            <asp:ListItem Selected="True" Value="0">Всички</asp:ListItem>
            <asp:ListItem Value="1">Събития</asp:ListItem>
            <asp:ListItem Value="2">Новини</asp:ListItem>
            <asp:ListItem Value="3">Други</asp:ListItem>
        </asp:DropDownList>
    </h3>
    <br />
    <asp:UpdatePanel runat="server" ID="UpdateDocsPanel" UpdateMode="Conditional">
        <contenttemplate>
            <asp:ListView ID="ListDocs" runat="server" Visible="False">
                <LayoutTemplate>
                    <div id="itemPlaceholderContainer" runat="server">
                        <span id="itemPlaceholder" runat="server" />
                    </div>
                </LayoutTemplate>
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLinkDocs" runat="server" Text='<%#Eval("Name")%>' NavigateUrl='<%# Eval("Link") %>'>
                    </asp:HyperLink><br />
                    <asp:Label ID="DocDescription" runat="server" Text='<%#Eval("Description")%>' />
                    <br />
                </ItemTemplate>
            </asp:ListView>
            <%--<asp:DataPager ID="pagerListDocs" runat="server" PageSize="20" PagedControlID="ListDocs">
                <Fields>
                    <asp:NumericPagerField ButtonType="Link" NextPageText="Следваща" PreviousPageText="Предишна" />
                </Fields>
            </asp:DataPager>--%>
        </contenttemplate>
        <triggers>
            <asp:AsyncPostBackTrigger ControlID="DocTypeDropDown" EventName="SelectedIndexChanged" />
        </triggers>
    </asp:UpdatePanel>
    <%--EduMaterials by Discipline ListView--%>
    <asp:ListView ID="ListDicsEduMaterials" runat="server" Visible="False">
        <layouttemplate>
            <div id="itemPlaceholderContainer" runat="server">
                <span id="itemPlaceholder" runat="server" />
            </div>
        </layouttemplate>
        <itemtemplate>
            <asp:HyperLink ID="LinkEduM" runat="server" Text='<%#Eval("Name")%>' NavigateUrl='<%#"Details.aspx?id=" + DataBinder.Eval(Container.DataItem,"ID") + "&type=" + DataBinder.Eval(Container.DataItem,"TypeID")%>'>
            </asp:HyperLink><br />
        </itemtemplate>
    </asp:ListView>
<%--    <asp:DataPager ID="pagerListDicsEduMaterials" runat="server" PageSize="20" PagedControlID="ListDicsEduMaterials">
        <fields>
            <asp:NumericPagerField ButtonType="Link" NextPageText="Следваща" PreviousPageText="Предишна" />
        </fields>
    </asp:DataPager>--%>
    <%--List Dynamic Content--%>
    <asp:ListView ID="ListDynCnt" runat="server" Visible="false">
        <layouttemplate>
            <div id="itemPlaceholderContainer" runat="server">
                <span id="itemPlaceholder" runat="server" />
            </div>
        </layouttemplate>
        <itemtemplate>
            <asp:HyperLink ID="LinkDynCnt" runat="server" Text='<%#Eval("Name")%>' NavigateUrl='<%#"Details.aspx?id=" + DataBinder.Eval(Container.DataItem,"ID") + "&type=" + DataBinder.Eval(Container.DataItem,"TypeID")%>'>
            </asp:HyperLink><br />
        </itemtemplate>
    </asp:ListView>
    <%--<asp:DataPager ID="pagerListDynCnt" runat="server" PageSize="20" PagedControlID="ListDynCnt">
        <fields>
            <asp:NumericPagerField ButtonType="Link" NextPageText="Следваща" PreviousPageText="Предишна" />
        </fields>
    </asp:DataPager>--%>
</asp:Content>
